package org.dong.base.jvm.bytecode;

import org.openjdk.jol.info.ClassLayout;

import java.io.Serializable;

public class ByteCodeArch implements Serializable {
    private Integer a ;
    public static int aa = 1 ;
    protected final static int aaa = 2 ;

    private String s ;
    public static  String ss ;
    protected final static String sss = "sssss" ;


    public void sayHello(){
        System.out.println("hello zhaodongchao");
    }

    public static void main(String[] args) {
        Integer a = 100000 , b = 2000000 ;
        changeValue(a,b);
        System.out.printf("main -> 交换后的值a=%d , b = %d%n",a,b);

        String str1 = "zhaodongchao" ;
        String str2 = "muyang" ;
        changeValue(str1,str2);
        System.out.println(str1+"--"+str2);


        changeValue2(str1,str2);
        System.out.println(str1+"--"+str2);

        People zhaodongchao = new DongDong();
        System.out.println(ClassLayout.parseClass(zhaodongchao.getClass()));
        System.out.println(ClassLayout.parseInstance(zhaodongchao).toPrintable());

        System.out.println(System.currentTimeMillis());
        System.out.println(null == null);
    }

    private static void changeValue(Integer a , Integer b){
        System.out.printf("交换前的值a=%d , b = %d%n",a,b);
        a = a +b ;
        b = a -b ;
        a = a -b;
        System.out.printf("交换后的值a=%d , b = %d%n",a,b);
    }

    private static void changeValue(String a , String b){
        System.out.printf("交换前的值a=%s , b = %s%n",a,b);
        String t =a ;
        a = b ;
        b = t ;
        System.out.printf("交换后的值a=%s , b = %s%n",a,b);
    }
    private static void changeValue2(String a , String b){
        System.out.printf("交换前的值a=%s , b = %s%n",a,b);
        a="123";
        b ="321";
        System.out.printf("交换后的值a=%s , b = %s%n",a,b);
    }
}
